package com.ledi.guns.modular.ledipay.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.ledi.guns.core.base.tips.Tip;
import com.ledi.guns.modular.ledipay.controller.req.school.SchoolQrReq;
import com.ledi.guns.modular.ledipay.service.SchoolQrService;

/**
 * 当面付
 * 
 * @author Administrator
 */
@RestController
@RequestMapping("/faceToFacePay")
public class FaceToFacePayController {

	protected final static Logger log = LoggerFactory.getLogger(FaceToFacePayController.class);

	@Autowired
	private SchoolQrService schoolQrService;

	/**
	 * @api {post} /faceToFacePay/uploadQr 上传二维码
	 * @apiGroup faceToFacePay
	 * @apiName uploadQr
	 * @apiVersion 1.3.0
	 * @apiParamExample {json} Request-Example:
	 *                  {
	 *                  type;种类：0黑白，1彩色，2嵌入
	 *                  picInfo;图片base64
	 *                  imgUrl;前端H5临时变量
	 *                  }
	 * @apiSuccessExample {json} Success-Response:
	 *                    {
	 *                    "code": 200,
	 *                    "message": "成功"
	 *                    }
	 */
	@RequestMapping(value = "uploadQr", method = RequestMethod.POST)
	public Tip uploadQr(@RequestBody SchoolQrReq schoolQrReq) {

		log.info("乐校收上传二维码信息请求-->:{}", schoolQrReq);

		return schoolQrService.uploadQr(schoolQrReq);

	}

	/**
	 * @api {GET} /faceToFacePay/queryQr 查询收费二维码
	 * @apiGroup faceToFacePay
	 * @apiName queryQr
	 * @apiVersion 1.3.0
	 * @apiSuccessExample {json} Success-Response:
	 *                    {
	 *                    "code": 200,
	 *                    "message": "成功"
	 *                    "data": {
	 *                    "imgUlr":"http://www.baidu.com",
	 *                    "type":"种类：0黑白，1彩色，2嵌入",
	 *                    "picUrl":
	 *                    "https://ccbucket-1252955498.cossh.myqcloud.com/image/2018/7/18/19c51a46-56d1-4a1d-ace3-092a9537c2ff.jpg"
	 *                    ,
	 *                    
	 *                    }
	 *                    }
	 */
	@GetMapping(value = "queryQr")
	public Tip queryQr() {

		return schoolQrService.queryQr();

	}
}
